package com.psytech.app.task.web_ui.client;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.psytech.app.task.web_ui.shared.UIUser;
import com.psytech.app.task.web_ui.shared.UiTask;

public interface TaskManagerServiceAsync {

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void saveTask(com.psytech.app.task.web_ui.shared.UiTask task, AsyncCallback<com.psytech.app.task.web_ui.shared.UiTask> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void listAllTask(com.psytech.app.task.web_ui.shared.UIUser user, AsyncCallback<java.util.List<com.psytech.app.task.web_ui.shared.UiTask>> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void removeTask(java.lang.String taskUid, AsyncCallback<Void> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void searchTaskByUID(java.lang.String uid, AsyncCallback<com.psytech.app.task.web_ui.shared.UiTask> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void getComments(java.lang.String taskUid, AsyncCallback<java.util.List<com.psytech.app.task.web_ui.shared.UIComment>> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void createComment(com.psytech.app.task.web_ui.shared.UIComment comment, AsyncCallback<Void> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void deleteComment(java.lang.String commentUid, AsyncCallback<Void> callback);

	/**
	 * GWT-RPC service asynchronous (client-side) interface
	 * 
	 * @see com.psytech.app.task.web_ui.client.TaskManagerService
	 */
	void whoAmI(AsyncCallback<com.psytech.app.task.web_ui.shared.UIUser> callback);

	/**
	 * Utility class to get the RPC Async interface from client-side code
	 */
	public static final class Util {
		private static TaskManagerServiceAsync instance;

		public static final TaskManagerServiceAsync getInstance() {
			if (instance == null) {
				instance = (TaskManagerServiceAsync) GWT.create(TaskManagerService.class);
				final ServiceDefTarget target = (ServiceDefTarget) instance;
				target.setServiceEntryPoint(GWT.getModuleBaseURL() + "task");
			}
			return instance;
		}

		private Util() {
			// Utility class should not be instanciated
		}
	}

	void listAffectedTask(UIUser user, AsyncCallback<List<UiTask>> callback);

	void listAllTeamTask(AsyncCallback<List<UiTask>> callback);

	void listUnaffectedTask(AsyncCallback<List<UiTask>> callback);

	void getTeamMember(String groupName, AsyncCallback<List<UIUser>> callback);

	void getGroups(String userUid, AsyncCallback<List<String>> callback);
}
